import cv2 as cv
import sys
import os
from python_ai.common.xcommon import *
import matplotlib.pyplot as plt
import numpy as np
import time
import datetime


def draw_circle(event, x, y, flags, param):
    if event == cv.EVENT_LBUTTONDOWN:
        cv.circle(img, (x, y), 10, (0, 255, 0), -1)


# img = np.ones([480, 640, 3], dtype=np.uint8) * 255
img = np.full([480, 640, 3], 255, dtype=np.uint8)
title = 'Mouse click'
cv.namedWindow(title)
cv.setMouseCallback(title, draw_circle)

while(True):
    cv.imshow(title, img)
    k = cv.waitKey(100) & 0xFF
    if k == ord('q') or k == ord('Q') or k == 27:
        break
cv.destroyAllWindows()
